//
//  productModel.swift
//  AreaChainblock
//
//  Created by 赵佟越 on 2018/10/9.
//  Copyright © 2018年 zhaotongyue. All rights reserved.
//

import UIKit
import YYModel

@objcMembers
class productModel: NSObject , YYModel{
    
    var title : String?
    var e_title : String?
    var url : String?
    var content : String?
    var status : String?
    
    
    var ids : String?
    var mobile: String?
    var user_index : String?
    var dke : String?
    var count : Int?
    var extra_n : String?
    var m : String?
    var shengyu_time : NSNumber?
    var total : String?
    var per_page : String?
    var nick_name : String?
    
    var current_page : String?
    var last_page : String?
    var data : NSArray?
    var list : NSArray?
    var is_read : String?
    
    // M
    var n : String?
    var day : String?
    var value : String?
    var month : String?
    var type : String?
    var create_time : String?
    var m_value :String?
    var n_value :String?
    var myimages :String?
    //baozhi
    var baozhi_m :String?
    var total_m :String?
    var total_n :String?
    
    var wei_n :String?
    var wei_m :String?
    //team
    var is_releasing : String?
    var not_released : String?
    var released : String?
    var total_releasing :String?
    
    // 列表
    var days :String?
    var number :NSNumber?
    var price :NSNumber?
    
    
    // 矿
    var numbar :Int?
    var user_id :String?
    var baozhi_status :NSString?
    var cycle :NSString?
    var can_m :NSString?
    var d_dke :NSString?
    var shengyu :NSString?
    var all_baozhi :NSString?
    
    //
    var can_baozhi_m :NSString?
    var can_baozhi_n :NSString?
    var baozhi_n :NSString?
    
    // 完全释放 部分释放
    var can_finish :NSString?
    
    // 通知列表
    //var title :NSString?
    var mydescription :NSString?
    var e_description :NSString?
    
    var e_content :NSString?
    
    //var url :NSString?
    var add_time :NSString?
    
    override init() {
        super.init()
    }
    
    required convenience init?(coder aDecoder: NSCoder) {
        self.init()
        self.yy_modelInit(with: aDecoder)
    }
    
    func encode(with aCoder: NSCoder) {
        self.yy_modelEncode(with: aCoder)
    }
    
    static func modelCustomPropertyMapper() -> [String : Any]? {
        return ["ids":"id","myimages":"images","mydescription":"description"]
    }
    static func modelContainerPropertyGenericClass() -> [String : Any]? {
        return ["data":firstViewModel.classForCoder()]
    }
    
    override var description: String {
        return yy_modelDescription()
    }
    
    class func getSavePath() -> String{
        let docPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] as NSString
        let path = (docPath as String) + "/first.plist"
        print(path)
        return path
    }
    
    class func saveCityModel(cityArr:[firstViewModel]) {
        let path = getSavePath()
        NSKeyedArchiver.archiveRootObject(cityArr, toFile: path)
    }
    
    class func getCityModelFromDie() -> [firstViewModel]{
        let cityModel = NSKeyedUnarchiver.unarchiveObject(withFile: getSavePath())
        return cityModel as! [firstViewModel]
    }
    
    
}


